package com.xhy.tool.authority;

import com.xhy.tool.utils.JwtUtils;

import javax.servlet.http.HttpServletRequest;
import java.util.Arrays;

/**
 * Author: Xhy
 * CreateTime: 2022-06-13 17:15
 */
public class XhyAuthority implements AuthorityVerify {
    @Override
    public Boolean authorityVerify(HttpServletRequest request, String[] permissions) {

        System.out.println("全局的:"+ Arrays.toString(permissions));
        String uId = JwtUtils.getMemberIdByJwtToken(request);
        for (String permission : permissions) {
            if (!AuthorityUtils.verify(uId,permission)) {
                return false;
            }
        }

        return true;
    }
}
